package com.ww.scm.valueObject.croe;

import net.sf.json.JSONObject;

import com.ww.core.utils.mapper.JsonMapper;



public class ResponseJson<T> {
	
	private JSONObject jsonObject;
	private JSONObject datesetObject;
	
	public ResponseJson(String dateset) {
		jsonObject=JSONObject.fromObject(dateset);
		datesetObject=(JSONObject)jsonObject.get("dataset");
	}
	
	public T toEntity(Class<T> clazz,String attributeName){
		JSONObject entityObject=(JSONObject)datesetObject.get(attributeName);
		return JsonMapper.buildNormalBinder().fromJson(entityObject.toString(),clazz);
	}
	


}
